#include "ant.hh"


Ants::Ants ()
{
  life_ = 5;
  food_ = 0;
  team_ = 0;
  max_score_ = 0;
}

Ants::~Ants ()
{
}

void
Ants::put_ph ()
{
  //
  // FIXME
  //
}

void
Ants::set_team (int n)
{
  team_ = n;
}

int
Ants::get_team ()
{
  return team_;
}

void
Ants::set_score (int n)
{
  max_score_ = n;
}

int
Ants::get_score ()
{
  return max_score_;
}

std::pair<int, int>*
Ants::get_rand_case ()
{
  Map *m = Map::instance ();
  int i = rand () % 8;

  if (i == 0 && pos_.second > 1)
    return new std::pair<int, int> (pos_.second - 1, pos_.first);
  else if (i == 1 && pos_.second > 1 && pos_.first < m->get_w ())
    return new std::pair<int, int> (pos_.second - 1, pos_.first + 1);
  else if (i == 2 && pos_.first < m->get_w ())
    return new std::pair<int, int> (pos_.second, pos_.first + 1);
  else if (i == 3 && pos_.first < m->get_w () && pos_.second < m->get_h ())
    return new std::pair<int, int> (pos_.second + 1, pos_.first + 1);
  else if (i == 4 && pos_.second < m->get_h ())
    return new std::pair<int, int> (pos_.second + 1, pos_.first);
  else if (i == 5 && pos_.second < m->get_h () && pos_.first > 1)
    return new std::pair<int, int> (pos_.second + 1, pos_.first - 1);
  else if (i == 6 && pos_.first > 1)
    return new std::pair<int, int> (pos_.second, pos_.first - 1);
  else if (i == 7 && pos_.second > 1 && pos_.first > 1)
    return new std::pair<int, int> (pos_.second - 1, pos_.first - 1);
  else
    throw MyErrors (1);
}
